import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';

import pxToViewport from 'postcss-px-to-viewport';

// https://vite.dev/config/

export default defineConfig({
  plugins: [react()],
  css: {
    postcss: {
      plugins: [
        pxToViewport({
          viewportWidth: 1980, // 设计稿的视口宽度
          viewportUnit: 'vw', // 希望使用的视口单位
          // 其他可选配置...
        }),
      ],
    },
  },
  server: {
    proxy: {
      '/api': {
        target: 'http://localhost:3000',
        changeOrigin: true,
        rewrite: (path: string) => path.replace(/^\/api/, ''),


      },
    
    },
  },
});
